using UnityEngine;

namespace Crosstales.UI
{
    // [Assembly-CSharp-firstpass.dll].Crosstales.UI.UIHint
    public class UIHint : MonoBehaviour
    {
        
        #region Crosstales.UI.UIHint.<lerpAlphaDown>d__8
        // [Assembly-CSharp-firstpass.dll].Crosstales.UI.UIHint.<lerpAlphaDown>d__8
        private sealed class _lerpAlphaDown_d__8 : IEnumerator<object>, IEnumerator, IDisposable
        {
            // Fields
            private int __1__state;
            private object __2__current;
            public UnityEngine.Component gameObjectToFade;
            public Crosstales.UI.UIHint __4__this;
            public float startAlphaValue;
            public float endAlphaValue;
            public float delay;
            public float time;
            
            // Properties
            private object System.Collections.Generic.IEnumerator<System.Object>.Current { get; }
            private object System.Collections.IEnumerator.Current { get; }
            
            // Methods
            public _lerpAlphaDown_d__8(int __1__state)
            {
                this.__1__state = __1__state;
            }
            private void System.IDisposable.Dispose()
            {
            
            }
            private bool MoveNext()
            {
                float val_12;
                float val_13;
                if((this.__1__state - 1) >= 2)
                {
                    goto label_1;
                }
                
                this.__1__state = 0;
                label_13:
                float val_12 = this.endAlphaValue;
                val_12 = val_12 + 0.01f;
                if(this.__4__this.Group.alpha >= val_12)
                {
                    goto label_4;
                }
                
                this.gameObjectToFade.gameObject.SetActive(value:  (this.__4__this.Disable == false) ? 1 : 0);
                return true;
                label_1:
                if(this.__1__state != 0)
                {
                        return true;
                }
                
                this.__1__state = 0;
                this.gameObjectToFade.gameObject.SetActive(value:  true);
                val_12 = 0f;
                this.__4__this.Group.alpha = (this.startAlphaValue >= 0) ? (S1) : (val_12);
                val_13 = this.delay;
                this.endAlphaValue = (this.endAlphaValue >= 0) ? (S1) : (val_12);
                if(val_13 <= 0f)
                {
                    goto label_13;
                }
                
                UnityEngine.WaitForSeconds val_8 = 536895821;
                val_8 = new UnityEngine.WaitForSeconds(seconds:  val_13);
                this.__2__current = val_8;
                this.__1__state = 1;
                return true;
                label_4:
                val_12 = this.endAlphaValue;
                val_13 = this.__4__this.Group.alpha;
                float val_10 = UnityEngine.Time.deltaTime;
                float val_11 = 1f - val_12;
                val_11 = val_11 / this.time;
                val_10 = val_11 * val_10;
                val_10 = val_13 - val_10;
                this.__4__this.Group.alpha = val_10;
                this.__2__current = 0;
                this.__1__state = 2;
                return true;
            }
            private object System.Collections.Generic.IEnumerator<System.Object>.get_Current()
            {
                return (object)this.__2__current;
            }
            private void System.Collections.IEnumerator.Reset()
            {
                27351792 = new System.NotSupportedException();
                throw 27351792;
            }
            private object System.Collections.IEnumerator.get_Current()
            {
                return (object)this.__2__current;
            }
        
        }
        
        #endregion
        
        
        #region Crosstales.UI.UIHint.<lerpAlphaUp>d__9
        // [Assembly-CSharp-firstpass.dll].Crosstales.UI.UIHint.<lerpAlphaUp>d__9
        private sealed class _lerpAlphaUp_d__9 : IEnumerator<object>, IEnumerator, IDisposable
        {
            // Fields
            private int __1__state;
            private object __2__current;
            public UnityEngine.Component gameObjectToFade;
            public Crosstales.UI.UIHint __4__this;
            public float startAlphaValue;
            public float endAlphaValue;
            public float delay;
            public float time;
            
            // Properties
            private object System.Collections.Generic.IEnumerator<System.Object>.Current { get; }
            private object System.Collections.IEnumerator.Current { get; }
            
            // Methods
            public _lerpAlphaUp_d__9(int __1__state)
            {
                this.__1__state = __1__state;
            }
            private void System.IDisposable.Dispose()
            {
            
            }
            private bool MoveNext()
            {
                UnityEngine.Component val_13;
                float val_14;
                if((this.__1__state - 1) >= 2)
                {
                    goto label_1;
                }
                
                this.__1__state = 0;
                label_15:
                float val_13 = this.endAlphaValue;
                val_13 = val_13 + (-0.01f);
                if(this.__4__this.Group.alpha <= val_13)
                {
                    goto label_4;
                }
                
                this.gameObjectToFade.gameObject.SetActive(value:  (this.__4__this.Disable == false) ? 1 : 0);
                return true;
                label_1:
                if(this.__1__state != 0)
                {
                        return true;
                }
                
                this.__1__state = 0;
                val_13 = this.gameObjectToFade;
                if(val_13 == 0)
                {
                        return true;
                }
                
                this.gameObjectToFade.gameObject.SetActive(value:  true);
                this.__4__this.Group.alpha = (this.startAlphaValue >= 0) ? (S1) : 0f;
                val_14 = this.delay;
                this.endAlphaValue = (this.endAlphaValue >= 0) ? (S1) : 0f;
                if(val_14 <= 0f)
                {
                    goto label_15;
                }
                
                UnityEngine.WaitForSeconds val_9 = 536895821;
                val_13 = val_9;
                val_9 = new UnityEngine.WaitForSeconds(seconds:  val_14);
                this.__2__current = val_13;
                this.__1__state = 1;
                return true;
                label_4:
                val_13 = this.__4__this.Group;
                val_14 = val_13.alpha;
                float val_11 = UnityEngine.Time.deltaTime;
                val_11 = (this.endAlphaValue / this.time) * val_11;
                val_11 = val_14 + val_11;
                val_13.alpha = val_11;
                this.__2__current = 0;
                this.__1__state = 2;
                return true;
            }
            private object System.Collections.Generic.IEnumerator<System.Object>.get_Current()
            {
                return (object)this.__2__current;
            }
            private void System.Collections.IEnumerator.Reset()
            {
                27351792 = new System.NotSupportedException();
                throw 27351792;
            }
            private object System.Collections.IEnumerator.get_Current()
            {
                return (object)this.__2__current;
            }
        
        }
        
        #endregion
        
        // Fields
        public UnityEngine.CanvasGroup Group;
        public float Delay;
        public float FadeTime;
        public bool Disable;
        public bool FadeAtStart;
        
        // Methods
        private void Start()
        {
            if(this.FadeAtStart == false)
            {
                    return;
            }
            
            this.FadeDown();
        }
        public void FadeUp()
        {
            UnityEngine.Coroutine val_2 = this.StartCoroutine(routine:  this.lerpAlphaUp(startAlphaValue:  0f, endAlphaValue:  1f, time:  this.FadeTime, delay:  this.Delay, gameObjectToFade:  this.Group));
        }
        public void FadeDown()
        {
            UnityEngine.Coroutine val_2 = this.StartCoroutine(routine:  this.lerpAlphaDown(startAlphaValue:  1f, endAlphaValue:  0f, time:  this.FadeTime, delay:  this.Delay, gameObjectToFade:  this.Group));
        }
        private System.Collections.IEnumerator lerpAlphaDown(float startAlphaValue, float endAlphaValue, float time, float delay, UnityEngine.Component gameObjectToFade)
        {
            object val_1 = 536901097;
            val_1 = new System.Object();
            mem[536901113] = 0;
            mem[536901137] = this;
            mem[536901145] = startAlphaValue;
            mem[536901149] = endAlphaValue;
            mem[536901153] = delay;
            mem[536901157] = time;
            mem[536901129] = gameObjectToFade;
            return (System.Collections.IEnumerator)val_1;
        }
        private System.Collections.IEnumerator lerpAlphaUp(float startAlphaValue, float endAlphaValue, float time, float delay, UnityEngine.Component gameObjectToFade)
        {
            object val_1 = 536901099;
            val_1 = new System.Object();
            mem[536901115] = 0;
            mem[536901139] = this;
            mem[536901147] = startAlphaValue;
            mem[536901151] = endAlphaValue;
            mem[536901155] = delay;
            mem[536901159] = time;
            mem[536901131] = gameObjectToFade;
            return (System.Collections.IEnumerator)val_1;
        }
        public UIHint()
        {
            this.Delay = 2f;
            this.FadeTime = 0f;
            this.Disable = true;
            this.FadeAtStart = true;
        }
    
    }

}
